package com.stepin2it.newstalk;

import java.io.IOException;
import java.net.URL;

import com.stepin2it.newstalk.NewsListActivity.MyCustomAdapter;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

public class NewsDetailViewActivity extends Activity
{
	private static final String TAG = "NewsDetailViewActivity";
	private static final boolean DEBUG = true;
	private long mPhotoId;
	private TextView mTextView1;
	private ImageView mImageView1;
	private class BackgroundTask extends AsyncTask<URL, Integer, Long>
	{
		@Override
		public Long doInBackground(URL... urls)
		{
			try
			{
				read();
			} catch (IOException e)
			{
				e.printStackTrace();
			}
			return null;
		}

		protected void onProgressUpdate(Integer... progress)
		{

		}
		@Override
		public void onPreExecute()
		{

		}
		@Override
		public void onPostExecute(Long result)
		{
			display();
		}
	}
	protected void read() throws IOException
	{
		//TODO read the photo
	}
	
	protected void display()
	{
		// TODO display the photo
		
		
	}
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_newsdetail);
		mTextView1 = (TextView) this.findViewById(R.id.textView1);
		
		mImageView1 = (ImageView) this.findViewById(R.id.imageView1);
		
		mPhotoId = getIntent().getLongExtra("PHOTO_ID", 0);
		new BackgroundTask().execute();
		mTextView1.setText("Photo : " + mPhotoId);
		
		
		if (DEBUG) 
		{
			Log.d(TAG, "Photo : " + mPhotoId);
		}
	}

}
